using FreeSql.DataAnnotations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LF.Domain.Entities
{
    /// <summary>
    /// 文档分块实体
    /// </summary>
    public class DocumentChunk : BaseEntity
    {
        /// <summary>
        /// 关联的知识库文件ID
        /// </summary>
        public Guid KnowledgeFileId { get; set; }
        
        /// <summary>
        /// 关联的知识库文件
        /// </summary>
        [Navigate(nameof(KnowledgeFileId))]
        public virtual KnowledgeFile KnowledgeFile { get; set; }
        
        /// <summary>
        /// 分块内容
        /// </summary>
        [Column(StringLength = -1)]
        public string Content { get; set; }
        
        /// <summary>
        /// 向量嵌入，JSON序列化的浮点数组
        /// </summary>
        [Column(StringLength = -1)]
        public string Embedding { get; set; }
        
        /// <summary>
        /// 块在文档中的顺序
        /// </summary>
        public int ChunkOrder { get; set; }
        
        /// <summary>
        /// 分块类型：0=固定长度，1=问答对，2=段落
        /// </summary>
        public int ChunkType { get; set; }
        
        /// <summary>
        /// 当分块类型为问答对时，存储问题内容
        /// </summary>
        [Column(StringLength = 500)]
        public string Question { get; set; }
    }
} 